<?php

/**
 *      This is NOT a freeware, use is subject to license terms
 *      应用名称: DiscuzQ 转 DiscuzX 1.2
 *      下载地址: https://addon.dismall.com/plugins/qconverx.html
 *      应用开发者: 科站网discuzlab.com
 *      开发者QQ: 839515338
 *      更新日期: 202312061210
 *      授权域名: 106.55.100.165
 *      授权码: 2023120604xgi69i0r51
 *      未经应用程序开发者/所有者的书面许可，不得进行反向工程、反向汇编、反向编译等，不得擅自复制、修改、链接、转载、汇编、发表、出版、发展与之有关的衍生产品、作品等
 */


/**
 *      (C)2001-2099 DiscuzLab.com.
 *      This is NOT a freeware, use is subject to license terms
 *      $Id: hook.class.php 2020-12-28 06:03:07Z Todd $
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

/* 插件代码开始 */

class qconverx
{
	function logging_limit(){
		global $_G;
		$seccodestatus = !empty($_GET['lssubmit']) ? false : $seccodecheck;
		include DISCUZ_ROOT.'./source/discuz_version.php';
		if (submitcheck('loginsubmit', 1, $seccodestatus) && DISCUZ_VERSION != 'X3.5') {
			if (!empty($_GET['auth'])) {
				list($_GET['username'], $_GET['password']) = daddslashes(explode("\t", authcode($_GET['auth'], 'DECODE', $_G['config']['security']['authkey'])));
			}

			$loginhash = !empty($_GET['loginhash']) && preg_match('/^\w+$/', $_GET['loginhash']) ? $_GET['loginhash'] : '';

			if (!($_G['member_loginperm'] = logincheck($_GET['username']))) {
				showmessage('login_strike');
			}
			if ($_GET['fastloginfield']) {
				$_GET['loginfield'] = $_GET['fastloginfield'];
			}
			$_G['uid'] = $_G['member']['uid'] = 0;
			$_G['username'] = $_G['member']['username'] = $_G['member']['password'] = '';
			if (!$_GET['password'] || $_GET['password'] != addslashes($_GET['password'])) {
				showmessage('profile_passwd_illegal');
			}
			$member = DB::fetch_first('SELECT * FROM %t WHERE username=%s', array('ucenter_members', addslashes($_GET['username'])));
			if (strlen($member['password']) == 32 || $member['salt']) return '';
			if (password_verify($_GET['password'], $member['password'])) {
				$salt = random(4);
				$password = md5(md5($_GET['password']) . $salt);
				DB::update('ucenter_members', array('password' => $password, 'salt' => $salt), array('uid' => $member['uid']));
			}
			return '';
		}
	}
}
class plugin_qconverx_member extends qconverx
{
}
class mobileplugin_qconverx_member extends qconverx
{
}